package com.diversitopia.ui;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class UserOptionsDisplay extends JPanel {

	private JCheckBox isUserEnabled;
	private JLabel userName;
	private JLabel userComments;
	private JLabel userTotalWorth;
	private JLabel userStocksList; //per year listings
	private JTextField txtUserName;
	private JTextField txtUserComments;
	private JTextField txtUserTotalWorth;
	private JComboBox cboUserStocksList; //per year listings
	private JComboBox cboUserList; //list of available users
	
	public UserOptionsDisplay() {
		super();
		// TODO Auto-generated constructor stub

		this.initComponents();		
		// TODO Auto-generated constructor stub
		this.cboUserList.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				txtUserName.setText(cboUserList.getSelectedItem().toString());
				userName.setText(cboUserList.getSelectedItem().toString());
			}
			
		});
		this.cboUserStocksList.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				userStocksList.setText(cboUserStocksList.getSelectedItem().toString());
			}
			
		});
		this.setLayout(null);
		this.add(this.cboUserList);
		this.add(this.cboUserStocksList);
		this.add(this.userName);
		this.add(this.userStocksList);
		
		//set layout locations
		this.cboUserList.setBounds(0, 0, 200, 30);
		this.cboUserStocksList.setBounds(0, 32, 200, 30);
		this.userName.setBounds(0, 64, 200, 30);
		this.userStocksList.setBounds(0, 96, 200, 30);
	}

	public UserOptionsDisplay(boolean arg0) {
		super(arg0);
	}

	public UserOptionsDisplay(LayoutManager arg0, boolean arg1) {
		super(arg0, arg1);
		// TODO Auto-generated constructor stub
	}

	public UserOptionsDisplay(LayoutManager arg0) {
		super(arg0);
		// TODO Auto-generated constructor stub
	}

	private void initComponents() {
		this.cboStubFiller();
		this.labelStubFiller();	
		this.cboUserList.setSize(200, 30);
		this.cboUserStocksList.setSize(200, 30);
	}
	private void labelStubFiller() {
		//
		this.userName = new JLabel(cboUserList.getSelectedItem().toString());
		this.userStocksList = new JLabel(cboUserStocksList.getSelectedItem().toString());
		this.txtUserName = new JTextField(cboUserList.getSelectedItem().toString());
	}
	private void cboStubFiller() {
		this.cboUserList = new JComboBox();
		this.cboUserList.addItem("Louise");
		this.cboUserList.addItem("Terri");
		this.cboUserList.addItem("Bobbi");
		this.cboUserList.addItem("Shawn");
		
		this.cboUserStocksList = new JComboBox();
		this.cboUserStocksList.addItem("2009");
		this.cboUserStocksList.addItem("2010");
		this.cboUserStocksList.addItem("2011");
		this.cboUserStocksList.addItem("2012");
		this.cboUserStocksList.addItem("2013");
		this.cboUserStocksList.addItem("2014");
		this.cboUserStocksList.addItem("2015");
	}
}
